<html>

<head>
    <title>周报 - #date(main.xBeginTime, "yyyy-MM-dd HH:mm") ~ #date(main.xEndTime, "yyyy-MM-dd HH:mm") 第#date(main.xBeginTime, "w")周</title>
    <style type="text/css">
        
        table.gradienttable {
            font-family: verdana, arial, sans-serif;
            border-width: 3px;
            border-collapse: collapse;
            width: 100%;
            text-align: center;
        }
        /**
        table.gradienttable th {
            padding: 3px;
            color: #FFFFFF;
            background: #000066;
            font-size: 12px;
        }
        
        table.gradienttable td {
            padding: 3px;
            color: #000000;
            font-size: 11px;
            background: #ebecda;
            text-align: center;
        }
        
        table.gradienttable th p {
            margin: 3px;
            padding: 9px;
        }
        
        table.gradienttable td p {
            padding: 9px;
        }
        **/
        input {
            line-height: 2em;
            font-size:1.5em;
        }
        label {
            line-height: 2em;
            font-size:1.5em;
        }
    </style>
    <script>
        function openWeekSummary() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/weeksummary?date=' + encodeURIComponent(date);

            // 打开新窗口
            window.open(url, '_blank');
        }

        function refreshFeishu() {
            var selectedMan = document.querySelector('input[name="man"]:checked').value;
            var url = '/task/feishu?man=' + encodeURIComponent(selectedMan);
            window.location.href = url;
        }

        function build(id) {
            var url = '/devreport/build?sID=' + id;
            window.location.href = url;
        }

        function audit(id) {
            var url = '/devreport/audit?sID=' + id;
            window.location.href = url;
        }


        
        function check() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/check?date=' + encodeURIComponent(date) + '&force=true';
            window.location.href = url;
        }
    </script>
    <script>
        function openTab(evt, tabName) {
            var i, tabcontent, tablinks;
            tabcontent = document.getElementsByClassName("tabcontent");
            for (i = 0; i < tabcontent.length; i++) {
                tabcontent[i].style.display = "none";
            }
            tablinks = document.getElementsByClassName("tablinks");
            for (i = 0; i < tablinks.length; i++) {
                tablinks[i].className = tablinks[i].className.replace(" active", "");
            }
            document.getElementById(tabName).style.display = "block";
            evt.currentTarget.className += " active";
        }
    
        // 默认打开第一个标签页
        document.addEventListener("DOMContentLoaded", function(event) { 
            document.getElementById("defaultOpen").click();
        });
    </script>
</head>

<body>
    <style>
        /* 标签页样式 */
        .tab {
            overflow: hidden;
            border: 1px solid #ccc;
            background-color: #f1f1f1;
        }
    
        .tab button {
            background-color: inherit;
            float: left;
            border: none;
            outline: none;
            cursor: pointer;
            padding: 14px 16px;
            transition: 0.3s;
        }
    
        .tab button:hover {
            background-color: #ddd;
        }
    
        .tab button.active {
            background-color: #ccc;
        }
    
        .tabcontent {
            display: none;
            padding: 6px 12px;
            border: 1px solid #ccc;
            border-top: none;
        }
    </style>
    <div style="width:100%;margin-left:auto;margin-right:auto;">
        
        <div style="text-align:right;font-size:2em;width:60em;margin-left:auto;margin-right:auto;">
            <form action="/devreport/update" method="post" style="text-align:left;width:60em;margin-left:auto;margin-right:auto;">
                <input type="hidden" id="sID" name="sID" value="#(main.sID)" required>

                <table style="width:60em;margin-left:auto;margin-right:auto;">
                    <tr>
                        <td style="width:10em;line-height: 0em;">&nbsp;</td>
                        <td style="width:20em;line-height: 0em;">&nbsp;</td>
                        <td style="width:10em;line-height: 0em;">&nbsp;</td>
                        <td style="width:20em;line-height: 0em;">&nbsp;</td>
                    </tr>
                    
                    <tr>
                        <td style="text-align:right;">开始时间</td>
                        <td style="text-align: left;">
                            <input type="datetime-local" id="xBeginTime" name="xBeginTime" value="" required style="" #if(main.sStatus>2) readonly #end>
                        </td>
                        <td style="text-align:right;">结束时间</td>
                        <td style="text-align: left;">
                            <input type="datetime-local" id="xEndTime" name="xEndTime" value="" required style=""#if(main.sStatus>2) readonly #end>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;" colspan="3">紧急任务分配截止时间</td>
                        <td style="text-align: left;">
                            <input type="datetime-local" id="xEmergencyDeadline" name="xEmergencyDeadline" value="" required style="" #if(main.sStatus>2) readonly #end>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">天数</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xDayCnt" value="#number(main.xDayCnt, "0.#")" style="width:100%;" #if(main.sStatus>2) readonly #end></input>
                        </td>
                        <td style="text-align:right;">应产出工时</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xHours" value="#number(main.xHours, "0.#")"  style="width:100%" #if(main.sStatus>2) readonly #end></input>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">周开发成本</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xCost" value="#number(main.xCost, "0.#")" style="width:100%" #if(main.sStatus>2) readonly #end></input>
                        </td>
                        <td style="text-align:right;">总应产出工时</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xTotalHour" value="#number(main.xTotalHour, "0.#")"  style="width:100%" #if(main.sStatus>2) readonly #end></input>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">飞书人数</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xFeishuEmplCnt" value="#number(main.xFeishuEmplCnt, "0.#")" style="width:100%;" #if(main.sStatus>2) readonly #end></input>
                        </td>
                        <td style="text-align:right;">飞书工时</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xFeishuHour" value="#number(main.xFeishuHour, "0.#")"  style="width:50%" #if(main.sStatus>2) readonly #end></input>
                            飞书效率: #number(main.xFeishuRate, "0.#")%
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">TAPD人数</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xTapdEmplCnt" value="#number(main.xTapdEmplCnt, "0.#")" style="width:100%;" #if(main.sStatus>2) readonly #end></input>
                        </td>
                        <td style="text-align:right;">TAPD工时</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xTapdHour" value="#number(main.xTapdHour, "0.#")"  style="width:50%" #if(main.sStatus>2) readonly #end></input>
                            飞书效率: #number(main.xTapdRate, "0.#")%
                        </td>
                    </tr>
                    
                    <tr>
                        <td style="text-align:right;">紧急未完成任务数</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xEmergencyCnt" value="#number(main.xEmergencyCnt, "0.#")" style="width:100%;" #if(main.sStatus>2) readonly #end></input>
                        </td>
                        <td style="text-align:right;">未分配开发任务数</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xWaitingTaskCnt" value="#number(main.xWaitingTaskCnt, "0.#")"  style="width:100%" #if(main.sStatus>2) readonly #end></input>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">未标记需求数</td>
                        <td style="text-align: left;">
                            <input type="number"  step="any" name="xWaitingCloseTaskCnt" value="#number(main.xWaitingCloseTaskCnt, "0.#")" style="width:100%;" #if(main.sStatus>2) readonly #end></input>
                        </td>
                        <td style="text-align: left;" colspan="2">需求下所有开发已标记任务完成但需求状态未标记</td>
                    </tr>
                    <tr>
                        <td style="text-align:right;">备注</td>
                        <td style="text-align: left;" colspan="3">
                            <!-- 多行输入 -->
                             <textarea name="xNote" style="width:100%;height:10em;" #if(main.sStatus>2) readonly #end>#(main.xNote)</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right;" colspan="4"> 
                            <button type="button" style="height:3em;width:7em;" onclick="build(#(main.sID))">生成数据</button>&nbsp;
                            &nbsp;
                            <button type="submit" style="height:3em;width:7em;" #if(main.sStatus>2) disabled="disabled" #end >提交修改</button>&nbsp;
                            &nbsp;
                            <button type="button" style="height:3em;width:7em;" onclick="audit(#(main.sID))">审核</button>&nbsp;
                            &nbsp;
                        </td>
                    </tr>
                </table>

                <script>
                    // 设置日期输入框的默认值为当天日期
                    document.getElementById('xBeginTime').value = '#date(main.xBeginTime,"yyyy-MM-dd HH:mm")';
                    document.getElementById('xEndTime').value = '#date(main.xEndTime,"yyyy-MM-dd HH:mm")';
                    document.getElementById('xEmergencyDeadline').value = '#date(main.xEmergencyDeadline,"yyyy-MM-dd HH:mm")';
                </script>
            </form>

        </div>
        <div class="tab">
            <button class="tablinks" onclick="openTab(event, 'summary')" id="defaultOpen">周工时汇总统计</button>
            <button class="tablinks" onclick="openTab(event, 'detailed')">周工时汇总统计-详细</button>
            <button class="tablinks" onclick="openTab(event, 'groups')">各组统计</button>
            <button class="tablinks" onclick="openTab(event, 'tasks')">完成任务明细</button>
            <button class="tablinks" onclick="openTab(event, 'emergencies')">紧急未完成任务清单</button>
            <button class="tablinks" onclick="openTab(event, 'customer')">分客户工时成本统计</button>
            <button class="tablinks" onclick="openTab(event, 'dates')">按日期统计</button>
            <button class="tablinks" onclick="openTab(event, 'feishu')">飞书工时记录</button>
            #if(main.sStatus<=2)
            <button class="tablinks" onclick="openTab(event, 'edit')">周工时编辑</button>
            #end
        </div>

        
        <div style="text-align:left;width:#(35+(ds.size()*6)+10)em;margin-left:auto;margin-right:auto;" id="summary" class="tabcontent">
            <h2>周工时汇总统计</h2>
            <div style="margin-top:2em;margin-bottom:2em;">
                <table class="gradienttable" border="1" style="width:#(35+(ds.size()*6)+10)em;line-height:2em;">
                    <tr>
                        <th style="width:4em;">&nbsp;</th>
                        #for(d : ds)
                            <th style="width:7em;">#date(d,"MM-dd EEEE")</th>
                        #end
                        <th style="width:5em;">飞书工时h</th>
                        <th style="width:5em;">飞书效率%</th>
                        <th style="width:6em;">TAPD工时h</th>
                        <th style="width:7em;">TAPD效率%</th>
                        <th style="width:6em;">平均效率%</th>
                    </tr>
                    #for(x:items)
                        <tr>
                            <td>#(x.xMan)</td>
                            #set(idx=1)
                            #for(d : ds)
                                <td>#if(x.getFloat("xFeishu"+idx)>0) #number(x.getFloat("xFeishu"+idx),"0.#") #else &nbsp; #end</td>
                                #set(idx=idx+1)
                            #end
                            <td>#number(x.xFeishuHour,"0.#")</td>
                            <td>#number(x.xFeishuRate,"0.#")</td>
                            <td>#number(x.xTapdHour,"0.#")</td>
                            <td>#number(x.xTapdRate,"0.#")</td>
                            <td>#number(x.xRate,"0.#")</td>
                        </tr>
                    #end

                </table>
                #for(x:items)
                    <p>飞书统计人数:#number(x.xTotalFeishuEmplCnt, "0.#") , 飞书本周总工时:#number(x.xTotalFeishuHour, "0.#")h ,平均效率:#number(x.xTotalFeishuRate, "0.#") %
                        ; 飞书统计人数:#number(x.xTotalTapdEmplCnt, "0.#") , TAPD本周总工时:#number(x.xTotalTapdHour, "0.#")h ,平均效率:#number(x.xTotalTapdRate, "0.#")% 
                    </p>
                    #break
                #end
            </div>
        </div>
        <div style="text-align:left;width:#(25+(20+ds.size()*4)*2+5)em;margin-left:auto;margin-right:auto;" id="detailed" class="tabcontent">
            <h2>周工时汇总统计-详细</h2>
            <div style="margin-top:2em;margin-bottom:2em;">
                <table class="gradienttable" border="1" style="width:#(25+(20+ds.size()*4)*2+10)em;line-height:2em;">
                    <tr>
                        <th style="width:3em;" rowspan="2">序号</th>
                        <th style="width:4em;" rowspan="2">开发</th>
                        <th style="width:8em;" rowspan="2">应产出工时比例</th>
                        <th style="width:7em;" rowspan="2">应产出工时h</th>
                        <th style="" colspan="#(ds.size()+4)">飞书</th>
                        <th style="" colspan="#(ds.size()+4)">TAPD</th>
                        <th style="width:4em;" rowspan="2">平均效率%</th>
                    </tr>
                    <tr>
                        <th style="width:5em;">飞书记工时</th>
                        #for(d : ds)
                            <th style="width:3">#date(d,"MM-dd EEEE")</th>
                        #end
                        <th style="width:4em;">飞书工时h</th>
                        <th style="width:4em;">飞书效率%</th>
                        <th style="width:4em;">飞书总工时h</th>

                        <th style="width:6em;">TAPD记工时</th>
                        #for(d : ds)
                            <th style="width:3">#date(d,"MM-dd EEEE")</th>
                        #end
                        <th style="width:4em;">TAPD工时</th>
                        <th style="width:4em;">TAPD效率</th>
                        <th style="width:4em;">TAPD总工时</th>
                    </tr>
                    #for(x:items)
                        <tr>
                            <td>#(x.sIndex)</td>
                            <td>#(x.xMan)</td>
                            <td>#number(x.xTargetHourRate*100,"0.#")%</td>
                            <td>#number(x.xHour,"0.#")</td>
                            
                            <td>#if(x.xIsCountFeishu??) √ #else &nbsp;#end</td>
                            #set(idx=1)
                            #for(d : ds)
                                <td>#number(x.getFloat("xFeishu"+idx),"0.#")</td>
                                #set(idx=idx+1)
                            #end
                            <td>#number(x.xFeishuHour,"0.#")</td>
                            <td>#number(x.xFeishuRate,"0.#")</td>
                            <td>#number(x.xAFeishuHour,"0.#")</td>

                            <td>#if(x.xIsCountTapd??) √ #else &nbsp;#end</td>
                                #set(idx=1)
                                #for(d : ds)
                                    <td>#number(x.getFloat("xTapd"+idx),"0.#")</td>
                                    #set(idx=idx+1)
                                #end
                            <td>#number(x.xTapdHour,"0.#")</td>
                            <td>#number(x.xTapdRate,"0.#")</td>
                            <td>#number(x.xATapdHour,"0.#")</td>
                            <td>#number(x.xRate,"0.#")</td>
                        </tr>
                    #end
                </table>
            </div>
        </div>
        <div style="text-align:left;width:99%;margin-left:auto;margin-right:auto;" id="groups" class="tabcontent">
            <h2>各组统计</p>
            <div style="margin-top:2em;margin-bottom:2em;">
                <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                    <tr>
                        <th style="width:3em;">序号</th>
                        <th style="width:7em;">组别</th>
                        <th style="width:4em;">人数</th>
                        <th style="width:4em;">应产出工时h</th>
                        <th style="width:7em;">飞书工时h</th>
                        <th style="width:10em;">飞书效率%</th>
                        <th style="width:4em;">TPAD工时h</th>
                        <th style="width:4em;">TAPD效率%</th>
                    </tr>
                    #for(x:teams)
                    <tr>
                        <td>#(x.sIndex)</td>
                        <td>#(x.xTeam)</td>
                        <td>#(x.xEmplCnt)</td>
                        <td>#number(x.xTotalHour,"0.#")</td>
                        <td>#number(x.xFeishuHour,"0.#")</td>
                        <td>#number(x.xFeishuRate,"0.#")</td>
                        <td>#number(x.xTapdHour,"0.#")</td>
                        <td>#number(x.xTapdRate,"0.#")</td>
                    </tr>
                    #end
                </table>
            </div>

        </div>
        <div style="text-align:left;width:99%;margin-left:auto;margin-right:auto;" id="tasks" class="tabcontent">
            <h2>完成任务明细</h2>
            #for(g:teams)
                #set(groupinited=0)
                #set(groupcnt=0)
                #set(mancnt=0)
                #set(groupattendancehour=0.0)
                #set(grouptotalhour=0.0)
                
                #for(x:mans)
                    #if(x.xGroup==g.xTeam)
                        #set(mancnt=mancnt+1)
                        #for(y:tasks)
                            #if(x.xName==y.xMan)
                                #set(groupcnt=groupcnt+1)
                            #end
                        #end
                    #end
                #end
                <div style="margin-top:2em;margin-bottom:2em;">
                    <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                        <tr>
                            <th style="width:5em;">ID</th>
                            <th>标题</th>
                            <th style="width:4em;">状态</th>
                            <th style="width:7em;">标签</th>
                            <th style="width:10em;">客户</th>
                            <th style="width:4em;">优先级</th>
                            <th style="width:4em;">处理人</th>
                            <th style="width:8em;">完成时间</th>
                            <th style="width:5em;">预估工时</th>
                            <th style="width:5em;">开发工时</th>
                            <th style="width:5em;">个人效率</th>
                            <th style="width:8em;">小组</th>
                        </tr>

                        #for(x:mans)
                            #if(x.xGroup==g.xTeam)
                                #set(xman=x.xName)
                                #set(totalplanhour=0.0)
                                #set(totalhour=0.0)
                                #set(taskcnt=0)
                                #set(inited=0)
                                #for(y:tasks)
                                    #if(x.xName==y.xMan)
                                        #set(taskcnt=taskcnt+1)
                                    #end
                                #end
                                #for(y:tasks)
                                    #if(x.xName==y.xMan)
                                        #set(totalplanhour=totalplanhour+y.xPlanHour)
                                        #set(totalhour=totalhour+y.xHour)
                                        <tr>
                                            <td>#(y.xShortID)</td>  <!--超链接-->
                                            <td style="text-align:left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 20ch;">
                                                <a href="https://www.tapd.cn/#(y.rWorkspace_ID)/prong/tasks/view/#(y.sID)" target="_blank">#(y.xName)</a>
                                            </td> <!--左对齐-->
                                            <td>已完成</td>
                                            <td>#(y.xLabel)</td>
                                            <td>#(y.xCustName)</td>
                                            <td>#(y.xPriority)</td>
                                            <td>#(y.xMan)</td>
                                            <td>#date(y.xFinishTime,"MM-dd HH:mm")</td>
                                            <td>#(y.xPlanHour)</td>
                                            <td>#(y.xHour)</td>
                                            #if(inited==0) <td rowspan="#(taskcnt+1)" id="taskcnt_#(y.xMan)">&nbsp;</td> #end
                                            #if(groupinited==0) 
                                                <td rowspan="#(groupcnt+mancnt)"  style="vertical-align: top;">
                                                    <table style="width:100%;">
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">&nbsp;</td>
                                                            <td style="text-align:left;">&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align:center;width:100%;" colspan="2"><b>#(g.xTeam)</b></td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">人数:</td>
                                                            <td style="text-align:left;">#(g.xEmplCnt)</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">天数:</td>
                                                            <td style="text-align:left;">#number(main.xDayCnt, "0.#")</td>
                                                        </tr>
                                                        <!--
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">应产出工时:</td>
                                                            <td style="text-align:left;">#number(g.xTotalHour,"0.#")</td>
                                                        </tr>
                                                        -->
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">工时:</td>
                                                            <td style="text-align:left;">#number(g.xTapdHour,"0.#")</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">效率:</td>
                                                            <td style="text-align:left;">#number(g.xTapdRate,"0.#")%</td>
                                                        </tr>
                                                        <!--
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">飞书工时:</td>
                                                            <td style="text-align:left;">#number(g.xFeishuHour,"0.#")</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align:right;width:3em;">飞书效率:</td>
                                                            <td style="text-align:left;">#number(g.xFeishuRate,"0.#")%</td>
                                                        </tr>
                                                        -->
                                                    </table>
                                                </td> 
                                                #set(groupinited=1)
                                            #end
                                        </tr>
                                        #set(inited=1)
                                    #end
                                
                                #end
                            
                                <tr>
                                    <td colspan="8">合计</td>
                                    <td>#(totalplanhour)</td>
                                    <td>#(totalhour)</td>
                                    <script>
                                        #if(totalhour==null)
                                            #set(totalhour=0.0)
                                        #end
                                        #set(needhour=0.0)
                                        #for(d:items)
                                            #if(d.xMan==x.xName)
                                                #set(needhour=d.xHour)
                                            #end
                                        #end
                                        #if(needhour==null)
                                            #set(needhour=0.0)
                                        #end
                                        var rate = '#if(needhour>0)#number(totalhour/(needhour*x.xCountRate),"0.#%") #else 0.0 #end';
                                        document.getElementById('taskcnt_#(xman)').textContent = rate;
                                    </script>
                                    #if(x.xIsCount)
                                        #set(grouptotalhour=grouptotalhour+totalhour)
                                        #set(groupattendancehour=groupattendancehour+totalhour*x.xCountRate)
                                    #end
                                </tr>
                            #end
                        #end
                    </table>
                </div>
                <script>
                    #if(grouptotalhour==null)
                        #set(grouptotalhour=0.0)
                    #end
                    var grouptotalhour = #(grouptotalhour);
                    var grouptotalhourrate = '#if(groupattendancehour>0)#number(grouptotalhour/groupattendancehour,"0.#%") #else 0.0 #end';
                    document.getElementById('groupeffect_#(g.xGroup)').textContent = grouptotalhourrate
                </script>

            #end
            
        </div>
        <div style="text-align:left;width:99%;margin-left:auto;margin-right:auto;" id="emergencies" class="tabcontent">
            <h2 style="color: red;">紧急未完成任务清单 #(emergencys.size())</h2>
            <div style="width:100%;margin-left:auto;margin-right:auto;">
                #for(x:mans)
                    #set(cnt=0)
                    #for(y:emergencys)
                        #if(x.xName == y.xMan || x.xName2 == y.xMan)
                            #set(cnt=cnt+1)
                        #end
                    #end
                    #if(cnt > 0)
                        
                        <div style="margin-top:2em;margin-bottom:2em;">
                            <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                                <tr>
                                    <th style="width:6em;">ID</th>
                                    <th>标题</th>
                                    <th style="width:4em;">状态</th>
                                    <th style="width:7em;">标签</th>
                                    <th style="width:8em;">客户</th>
                                    <th style="width:4em;">优先级</th>
                                    <th style="width:4em;">处理人</th>
                                    <th style="width:6em;">预计开始</th>
                                    <th style="width:4em;">预估工时</th>
                                    <th style="width:4em;">预计结束</th>
                                    <th style="width:8em;">最后修改时间</th>
                                    <th style="width:8em;">创建时间</th>
                                </tr>
                                #for(y:emergencys)
                                    #if(x.xName == y.xMan || x.xName2 == y.xMan)
                                        <tr>
                                            <td>#(y.xShortID)</td>  <!--超链接-->
                                            <td style="text-align:left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 20ch;">
                                                <a href="https://www.tapd.cn/#(y.rWorkspace_ID)/prong/tasks/view/#(y.rTask_ID)" target="_blank">#(y.xName)</a>
                                            </td> <!--左对齐-->
                                            <td>#if(y.xStatus=="open") 未开始 #else 进行中 #end</td>
                                            <td>#(y.xLabel)</td>
                                            <td>#(y._Cust_Name)</td>
                                            <td>#(y.xPriority)</td>
                                            <td>#(y.xMan)</td>
                                            <td>#date(y.xBegin,"yyyy-MM-dd")</td>
                                            <td>#(y.xPlanHour)</td>
                                            <td>#date(y.xEnd,"yyyy-MM-dd")</td>
                                            <td>#date(y.sLastUpdate,"MM-dd HH:mm")</td>
                                            <td>#date(y.sCreateDate,"MM-dd HH:mm")</td>
                                        </tr>
                                    #end
                                    
                                #end
                            </table>
                        </div>
                    #end
                #end
            </div>
        </div>
        <div style="text-align:left;width:100%;margin-left:auto;margin-right:auto;" id="customer" class="tabcontent">
            #set(custstotalhour=0.0)
            #for(x:custhour1)
                #set(custstotalhour=x.xTotalHour)
                #break
            #end
            <h2>分客户工时成本统计 总工时:#number(custstotalhour,"0.#")</h2>
            <table class="gradienttable" border="1" style="width:#(mans.size()*4*3+25)em;line-height:2em;">
                <tr>
                    <th style="width:3em;" rowspan="2">序号</th>
                    <th style="width:7em;" rowspan="2">客户</th>
                    <th style="width:3em;" rowspan="2">工时h</th>
                    <th style="width:6em;" rowspan="2">工时占比%</th>
                    <th style="width:5em;" rowspan="2">成本</th>
                    <th style="width:#(mans.size()*4)em;" colspan="#(mans.size())">开发工时h (总工时:#number(custstotalhour,"0.#")h)</th>
                    <th style="width:#(mans.size()*4)em;" colspan="#(mans.size())">工时占比%</th>
                    <th style="width:#(mans.size()*4)em;" colspan="#(mans.size())">成本 (总成本:#number(main.xCost, "0.#"))</th>
                </tr>
                <tr>
                    #for(man:mans)
                        <th style="width:3em;">#(man.xName)</th>
                    #end
                    #for(man:mans)
                        <th style="width:3em;">#(man.xName)</th>
                    #end
                    #for(man:mans)
                        <th style="width:3em;">#(man.xName)</th>
                    #end
                </tr>
                #for(x:custhour1)
                    <tr>
                        <td>#(x.sIndex)</td>
                        <td>#(x.xCust)</td>
                        <td>#number(x.xHour, "0.#")</td>
                        <td>#number(x.xRate, "0.#")</td>
                        <td>#number(x.xCost, "0.#")</td>
                        #for(man:mans)
                            <td>
                                #set(finded=false)
                                #for(c:custhour2)
                                    #if(c.xCust==x.xCust)
                                        #if( c.xMan==man.xName)
                                            #set(finded=true)
                                            #number(c.xHour, "0.#")
                                            #break
                                        #end
                                    #end
                                #end
                                #if(!finded) &nbsp;#end
                            </td>
                        #end
                        #for(man:mans)
                            <td>
                                #set(finded=false)
                                #for(c:custhour2)
                                    #if(c.xCust==x.xCust)
                                        #if(c.xMan==man.xName)
                                            #set(finded=true)
                                            #number(c.xRate, "0.#")
                                            #break
                                        #end
                                    #end
                                #end
                                #if(!finded) &nbsp;#end
                            </td>
                        #end
                        
                        #for(man:mans)
                            <td>
                                #set(finded=false)
                                #for(c:custhour2)
                                    #if(c.xCust==x.xCust)
                                        #if(c.xMan==man.xName)
                                            #set(finded=true)
                                            #number(c.xCost, "0.#")
                                            #break
                                        #end
                                    #end
                                #end
                                #if(!finded) &nbsp;#end
                            </td>
                        #end
                    </tr>
                #end
            </table>
        </div>
        <div style="text-align:left;width:99%;margin-left:auto;margin-right:auto;" id="dates" class="tabcontent">
            <h2>按日期统计</h2>
            <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                
                <tr>
                    <th style="width:3em;" rowspan="2">序号</th>
                    <th style="width:5em;" rowspan="2">日期</th>
                    <th style="width:5em;" rowspan="2">开发</th>
                    <!--
                    <th style="width:7em;" rowspan="2">应产出工时比例</th>
                    <th style="width:6em;" rowspan="2">应产出工时h</th>
                    -->
                    <th style="width:22em;" colspan="3">飞书</th>
                    <th style="width:22em;" colspan="3">TAPD</th>
                </tr>
                <tr>
                    <th style="width:6em;">统计飞书工时</th>
                    <th style="width:5em;">飞书工时h</th>
                    <!-- <th style="width:5em;">飞书效率%</th> -->
                    <th style="width:6em;">飞书总工时h</th>
                    <th style="width:6em;">统计TAPD工时</th>
                    <th style="width:5em;">TAPD工时h</th>
                    <!-- <th style="width:5em;">TAPD效率%</th> -->
                    <th style="width:6em;">TAPD总工时h</th>
                </tr>
                #for(x:dates)
                    <tr>
                        <td><a href="" target="_blank">#(x.sIndex)</a></td>
                        <td>#date(x.xDate, "yyyy-MM-dd")</td>
                        <td>#(x.xMan)</td>
                        <!--
                        <td>#(x.xTargetHourRate)</td>
                        <td>#(x.xHour)</td>
                        -->
                        <td>#if(x.xIsCountFeishu??) √  #end</td>
                        <td>#number(x.xFeishuHour, "0.#")</td>
                        <!-- td>#number(x.xFeishuRate, "0.#")</td> -->
                        <td>#number(x.xAFeishuHour, "0.#")</td>
                        
                        <td>#if(x.xIsCountTapd??) √  #end</td>
                        <td>#number(x.xTapdHour, "0.#")</td>
                        <td>#number(x.xTapdRate, "0.#")</td>
                        <!-- <td>#number(x.xATapdHour, "0.#")</td> -->
                    </tr>
                #end
            </table>
        </div>
        <div style="text-align:left;width:99%;margin-left:auto;margin-right:auto;" id="feishu" class="tabcontent">
            <h2>飞书工时记录</h2>
            <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
                <tr>
                    <th style="width:3em;">序号</th>
                    <th style="width:7em;">日期</th>
                    <th style="width:10em;">开发</th>
                    <th style="width:10em;">客户</th>
                    <th style="width:30em;">任务名称</th>
                    <th style="width:3em;">已完成</th>
                    <th style="width:3em;">工时h</th>
                    <th style="width:5em;">当天总工时h</th>
                </tr>
                #for(x:feishus)
                    <tr>
                        <td><a href="" target="_blank">#(x.sIndex)</a></td>
                        <td>#date(x.xDate, "yyyy-MM-dd")</td>
                        <td>#(x.xMan)</td>
                        <td>#(x.xCust)</td>
                        <td style="text-align: left;">#(x.xName)</td>
                        <td>#if(x.xIsOK??) √ #else × #end</td>
                        <td>#number(x.xHour, "0.#")</td>
                        <td>#number(x.xTotalHour, "0.#")</td>
                    </tr>
                #end
            </table>
        </div>




        <div style="text-align:left;width:#(25+(20+ds.size()*4)*2+5)em;margin-left:auto;margin-right:auto;" id="edit" class="tabcontent">
            <h2>周工时汇总统计-编辑</h2>
            <style>
                
                table .edit td input {
                    width:100%;
                    text-align:center;
                }
            </style>
            <div style="margin-top:2em;margin-bottom:2em;">
                <form action="/devreport/saveedit" method="post">
                    <input type="hidden" id="mID" name="mID" value="#(main.sID)" required>
                    <input type="hidden" id="dids" name="dids" value="#(main.dids)" required>
                    <table class="gradienttable" border="1" style="width:#(25+(20+ds.size()*9)*2+10)em;line-height:2em;" id="edit">
                        <tr>
                            <th style="width:3em;" rowspan="2">序号</th>
                            <th style="width:4em;" rowspan="2">开发</th>
                            <th style="width:8em;" rowspan="2">应产出工时比例</th>
                            <th style="width:7em;" rowspan="2">应产出工时h</th>
                            <th style="" colspan="#(ds.size()+4)">飞书</th>
                            <th style="" colspan="#(ds.size()+4)">TAPD</th>
                            <th style="width:4em;" rowspan="2">平均效率%</th>
                        </tr>
                        <tr>
                            <th style="width:5em;">飞书记工时</th>
                            #for(d : ds)
                                <th style="width:6em;">#date(d,"MM-dd EEEE")</th>
                            #end
                            <th style="width:4em;">飞书工时h</th>
                            <th style="width:4em;">飞书效率%</th>
                            <th style="width:4em;">飞书总工时h</th>

                            <th style="width:6em;">TAPD记工时</th>
                            #for(d : ds)
                                <th style="width:6em;">#date(d,"MM-dd EEEE")</th>
                            #end
                            <th style="width:4em;">TAPD工时</th>
                            <th style="width:4em;">TAPD效率</th>
                            <th style="width:4em;">TAPD总工时</th>
                        </tr>
                        #for(x:items)
                            <tr>
                                <td>#(x.sIndex)</td>
                                <td>#(x.xMan)</td>
                                <td>#number(x.xTargetHourRate*100,"0.#")%</td>
                                <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xHour" value="#number(x.xHour, "0.#")" style="width:100%;text-align:center;" ></td>
                                <td><input type="checkbox" name="#(x.mID)_#(x.dID)_xIsCountFeishu" value="1" #if(x.xIsCountFeishu??) checked #end style="width:100%;text-align:center;"></td>
                                #set(idx=1)
                                #for(d : ds)
                                    <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xFeishu#(idx)" value="#number(x.getFloat("xFeishu"+idx),"0.#")" style="width:100%;text-align:center;" ></td>
                                    #set(idx=idx+1)
                                #end
                                <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xFeishuHour" value="#number(x.xFeishuHour, "0.#")" style="width:100%;text-align:center;" ></td>
                                <td>#number(x.xFeishuRate,"0.#")</td>
                                <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xAFeishuHour" value="#number(x.xAFeishuHour, "0.#")" style="width:100%;text-align:center;" ></td>

                                <td><input type="checkbox" name="#(x.mID)_#(x.dID)_xIsCountTapd" value="1" #if(x.xIsCountTapd??) checked #end style="width:100%;text-align:center;"></td>
                                #set(idx=1)
                                #for(d : ds)
                                    <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xTapd#(idx)" value="#number(x.getFloat("xTapd"+idx),"0.#")" style="width:100%;text-align:center;" ></td>
                                    #set(idx=idx+1)
                                #end
                                <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xTapdHour" value="#number(x.xTapdHour, "0.#")" style="width:100%;text-align:center;" ></td>
                                <td>#number(x.xTapdRate,"0.#")</td>
                                <td><input type="number"  step="any" name="#(x.mID)_#(x.dID)_xATapdHour" value="#number(x.xATapdHour, "0.#")" style="width:100%;text-align:center;" ></td>
                                <td>#number(x.xRate,"0.#")</td>
                            </tr>
                        #end
                        <tr>
                            <td colspan="#(5+(ds.size()+4)*2)" style="text-align: center;">
                                <button type="submit" style="height:5em;width:10em;">提交</button>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</body>
</html>